/*
 * Wazuh Vulnerability Scanner - Unit Tests
 * Copyright (C) 2015, Wazuh Inc.
 * September 21, 2023.
 *
 * This program is free software; you can redistribute it
 * and/or modify it under the terms of the GNU General Public
 * License (version 2) as published by the FSF - Free Software
 * Foundation.
 */

#include "feedIndexer_test.hpp"
#include "databaseFeedManager/eventContext.hpp"
#include "databaseFeedManager/feedIndexer.hpp"
#include <memory>
#include <string>
#include <vector>

/*
 * @brief Test instantiation of the FeedIndexer class.
 */
TEST_F(FeedIndexerTest, TestInstantiationOfTheFeedIndexerClass)
{
    std::shared_ptr<IndexerConnector> indexerConnector;

    // Instantiation of the FeedIndexer class.
    EXPECT_NO_THROW(std::make_shared<FeedIndexer<IndexerConnector>>(indexerConnector));
}

/*
 * @brief Test handleRequest of the FeedIndexer class.
 */
TEST_F(FeedIndexerTest, TestHandleRequest)
{
    // TODO: Remove GTEST_SKIP and add EXPECTS once the implementation of the 'Indexer Connector' module is completed
    GTEST_SKIP();
    std::vector<char> message;
    nlohmann::json resource;
    auto feedDatabase = std::make_unique<Utils::RocksDBWrapper>("temp");
    std::shared_ptr<IndexerConnector> indexerConnector;
    auto eventContext = std::make_shared<EventContext>(
        EventContext {.message = message, .resource = resource, .feedDatabase = feedDatabase.get()});

    std::shared_ptr<FeedIndexer<IndexerConnector>> feedIndexer;

    // Instantiation of the FeedIndexer class.
    EXPECT_NO_THROW(feedIndexer = std::make_shared<FeedIndexer<IndexerConnector>>(indexerConnector));

    // HandleRequest
    EXPECT_NO_THROW(feedIndexer->handleRequest(eventContext));
}
